package com.qiya.LiaoDa.Fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.qiya.LiaoDa.Fruit;
import com.qiya.LiaoDa.R;
import com.qiya.LiaoDa.Util.DividerItemDecorations;
import com.qiya.LiaoDa.ZViewPagerAdapter.RecyclerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 *
 */
public class DCFragment extends Fragment {

    private List<Fruit> fruitList = new ArrayList<>();


    public DCFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_sp, container, false);
        initFruits();
        return view;
    }
    @Override
    public void onStart() {
        super.onStart();
        initRv();
    }

    public void initRv(){
        RecyclerView recyclerView = getActivity().findViewById(R.id.recyclerView);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this.getActivity());
        recyclerView.setLayoutManager(layoutManager);
        RecyclerAdapter adapter = new RecyclerAdapter(fruitList);
        recyclerView.setAdapter(adapter);
        recyclerView.addItemDecoration(new DividerItemDecorations());
    }

    private void initFruits() {
        for (int i = 0; i < 2; i++) {
            Fruit apple = new Fruit("我校在2020年辽宁省大学生身体素质提升创新大赛中首创佳绩", R.drawable.star3);
            fruitList.add(apple);
            Fruit appl1 = new Fruit("理念引领，模式创新，挑战杯大赛五年民办高校居首位", R.drawable.pika);
            fruitList.add(appl1);
            Fruit apple2 = new Fruit("沈阳科技学院召开党委常委理论学习中心组学习会议", R.drawable.duola);
            fruitList.add(apple2);
            Fruit sadss = new Fruit("沈阳科技学院第一次学生代表大会顺利召开", R.drawable.xiaoxin);
            fruitList.add(sadss);
            Fruit dsad = new Fruit("@沈科人，认真的你们最可爱", R.drawable.wechat);
            fruitList.add(dsad);
            Fruit dsa = new Fruit("我校在2020年辽宁省机械设计大赛中首创佳绩", R.drawable.laoshu);
            fruitList.add(dsa);
            Fruit das = new Fruit("榜样引领前行，初心照亮梦想|我校举办2020年优秀学生事迹报告会", R.drawable.meimei);
            fruitList.add(das);
            Fruit qw = new Fruit("我校走访企业，深入校企联合", R.drawable.xiong1);
            fruitList.add(qw);
            Fruit fasf = new Fruit("社团活动|舞动青春，唱响祖国 主题社团专场活动圆满落幕", R.drawable.xiong2);
            fruitList.add(fasf);
            Fruit ad = new Fruit("我校举行党校第一期入党积极分子培训班开班仪式", R.drawable.xiong3);
            fruitList.add(ad);
            Fruit fd = new Fruit("我校在辽宁省大学生成图建模创新大赛中首创佳绩", R.drawable.xiong4);
            fruitList.add(fd);


        }
    }
}